package com.neardrug.mapper;

import com.neardrug.controller.dto.UserResetDTO;
import com.neardrug.entity.User;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface UserMapper {

    @Insert("insert into tb_user (name, email, password, phone, company, title) " +
            "values " +
            "(#{name},#{email},#{password},#{phone},#{company},#{title})")
    void save(User user);

    @Select("select * from tb_user where email=#{email}")
    List<User> judgeByEmail(String email);

    @Select("select * from tb_user where email=#{email}")
    User getByEmail(String email);

    @Select("select * from tb_user where name=#{name} and email=#{email}")
    User judgeByEmailAndName(UserResetDTO userResetDTO);

    void update(User user);
}
